package admin

import (
	auto "beergo/app/hr/auto/controller"
	"beergo/app/hr/conf"
	"beergo/conf/const/code"
	"beergo/lib/tool"
	"github.com/beego/beego/v2/server/web"
)

type JobApplyAdminController struct {
	auto.JobApplyController
}

func init() {
	web.Router(conf.UrlPrefixAdmin + "/JobApply/:id", 		&JobApplyAdminController{}, "*:GetAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/info", 		&JobApplyAdminController{}, "*:InfoAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/scan", 		&JobApplyAdminController{}, "*:ScanAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/list", 	    &JobApplyAdminController{}, "*:ListAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/update", 	&JobApplyAdminController{}, "*:UpdateAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/create", 	&JobApplyAdminController{}, "*:CreateAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/copy", 	    &JobApplyAdminController{}, "*:CopyAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/edit", 	    &JobApplyAdminController{}, "*:EditAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/delete", 	&JobApplyAdminController{}, "*:DeleteAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/:id/:field", &JobApplyAdminController{}, "*:SonsAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/choice", &JobApplyAdminController{}, "*:ChoiceAction")
	web.Router(conf.UrlPrefixAdmin + "/JobApply/category", &JobApplyAdminController{}, "*:CategoryAction")
}
//func (this *JobApplyAdminController) Prepare() {}
func (this *JobApplyAdminController) ListAction() {

	admin:=this.GetAdminUser()
	tool.JsonLog(admin)
	if admin.Id > 0 {
		this.QueryBuilder.Conditions["job__company__user__id"] = admin.Id
	}
	lists, err := this.Repository.GetList(this.QueryBuilder)
	if err != nil {
		this.StopError(code.Error, "系统错误", err.Error())
	}
	this.JsonData["lists"] = lists
	this.JsonData["query"] = this.QueryBuilder.FeedBack()
	this.ReturnSuccess("OK", this.JsonData)

}
//func (this *JobApplyAdminController) GetAction() {}
//func (this *JobApplyAdminController) InfoAction() {}
//func (this *JobApplyAdminController) ScanAction() {}
//func (this *JobApplyAdminController) CreateAction() {}
//func (this *JobApplyAdminController) UpdateAction() {}
//func (this *JobApplyAdminController) CopyAction() {}
//func (this *JobApplyAdminController) DeleteAction() {}
//func (this *JobApplyAdminController) EditAction() {}
//func (this *JobApplyAdminController) SonsAction() {}
//func (this *JobApplyAdminController) ChoiceAction() {}
//func (this *JobApplyAdminController) CategoryAction() {}
